using System.Runtime.InteropServices;
using Engine;
using Engine.Graphics;
using OpenTK.Graphics.ES30;

namespace SCIENEW {
    public class TechTreeBackgroundBatch2D : FlatBatch2D {
        public new static TechTreeBackgroundShader Shader = new();

        public new void Flush(bool clearAfterFlush = true) {
            Display.DepthStencilState = base.DepthStencilState;
            Display.RasterizerState = base.RasterizerState;
            Display.BlendState = base.BlendState;
            FlushWithCurrentState2(clearAfterFlush);
        }

        public void FlushWithCurrentState2(bool clearAfterFlush = true) {
            Shader.RenderSize = Display.RenderTarget == null ? new Vector2(1024) : new Vector2(Display.RenderTarget.Width, Display.RenderTarget.Height);
            Shader.Time = (float)(DateTime.Now.ToOADate() % 1 * 24 * 60 * 60 % 600);
            Shader.Transforms.World[0] = PrimitivesRenderer2D.ViewportMatrix();
            FlushWithCurrentStateAndShader(Shader, clearAfterFlush);
        }
    }
}